Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk-metrics): InMemoryMetricExporter clear metrics after shutdown #5214

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

paper2
Copy link
Contributor

@paper2 paper2 commented Nov 27, 2024

Which problem is this PR solving?

Fixes #5131

Short description of the changes

  • make InMemoryMetricExporter reset storing metrics after shutdown

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

The InMemoryExporter does not directly affect the functionality of this library, but I consider it a minor specification change for the library. In fact, I encountered this issue while using InMemoryExporter in another project. If there are tests that retrieve metrics after shutdown, they will fail.

How Has This Been Tested?

  • should get no metrics after shutdown

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@paper2 paper2 requested a review from a team as a code owner November 27, 2024 22:08
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.59%. Comparing base (fc94e46) to head (6db79c4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5214      +/-   ##
==========================================
- Coverage   94.60%   94.59%   -0.02%     
==========================================
  Files         315      315              
  Lines        8012     8013       +1     
  Branches     1617     1617              
==========================================
  Hits         7580     7580              
- Misses        432      433       +1     
Files with missing lines Coverage Δ
...s/sdk-metrics/src/export/InMemoryMetricExporter.ts 91.66% <100.00%> (+0.36%) ⬆️

... and 1 file with indirect coverage changes

@paper2 paper2 marked this pull request as draft November 27, 2024 22:15
@paper2 paper2 force-pushed the develop/clear-in-memoery-metrics-exporter-data-post-shutdown branch 3 times, most recently from 875ec47 to 5ba87cd Compare November 27, 2024 22:24
@paper2 paper2 changed the title Fixes #5131 Clear InMemoryMetricExporter Data Post-Shutdown to Align with Other Exporters fix(InMemoryMetricExporter) clear metrics after shutdown Nov 27, 2024
@paper2 paper2 force-pushed the develop/clear-in-memoery-metrics-exporter-data-post-shutdown branch from 5ba87cd to 2bf3748 Compare November 27, 2024 22:28
@paper2 paper2 marked this pull request as ready for review November 27, 2024 22:41
@david-luna david-luna self-requested a review November 29, 2024 09:33
CHANGELOG.md Outdated
@@ -12,6 +12,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
### :boom: Breaking Change

* feat(sdk-metrics): Add support for aggregation cardinality limit with a default limit of 2000. This limit can be customized via views [#5182](https://github.com/open-telemetry/opentelemetry-js/pull/5128)
* fix(InMemoryMetricExporter) clear metrics after shutdown to align with other exporters [#5131](https://github.com/open-telemetry/opentelemetry-js/issues/5131) @paper2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be considered breaking. The API remains intact and it's a fix to have the proper behaviour 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review!! I try to move it 🚀 (Enhancement).

@david-luna david-luna changed the title fix(InMemoryMetricExporter) clear metrics after shutdown fix(sdk-metrics): InMemoryMetricExporter clear metrics after shutdown Nov 29, 2024
@david-luna david-luna self-requested a review November 29, 2024 09:36
@david-luna
Copy link
Contributor

@paper2 I've updated the title to follow the guidelines :)

@paper2 paper2 force-pushed the develop/clear-in-memoery-metrics-exporter-data-post-shutdown branch from 2bf3748 to bbd9b5f Compare November 29, 2024 22:14
@paper2 paper2 force-pushed the develop/clear-in-memoery-metrics-exporter-data-post-shutdown branch from bbd9b5f to b3c14d5 Compare November 29, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Clear InMemoryMetricExporter Data Post-Shutdown to Align with Other Exporters
2 participants